<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fnx" uri="http://java.sun.com/jsp/jstl/functionsx"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="f" uri="http://www.sctv.com/tags/form"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="/WEB-INF/views/head.jsp"/>
    <style>
        .box-body{min-width: 960px;}
        .tabs{}
        .tabs li{float:left;background-color:#f4f4f4;border-left:1px solid #e2e2e2;border-top:1px solid #ddd;border-right:1px solid #ddd;margin-right:0px;}
        .tabs li a{color:#555555;float:left;text-decoration:none;padding:5px 12px;}
        .tabs li a:link,.tabs li a:visited,.tabs li a:hover,.tabs li a:active{text-decoration:none;}
        .tabs li.active{background-color:#FFFFFF;border-left:1px solid #ddd;border-top:1px solid #ddd;border-right:1px solid #ddd;}
        .tabs li.active a{color:#fff;background:#ed5565;border-color:#ed5565;}
        .tabs li.hover{background-color:#e7e7e7;border-left:1px solid #ddd;border-top:1px solid #ddd;border-right:1px solid #ddd;}
        .tabs li.hover a{color:#000;}
        .header{
            height: 60px;
            padding: 10px;
            margin-bottom: 10px;
        }
        .header input{
            height: 40px;
            border: 1px solid #ccc;
            outline: none;
            text-align: center;
        }
        .header a{
            height: 40px;
            width: 70px;
            text-align: center;
            line-height: 28px;
        }
        .main ul{
            padding-left: 40px;
        }
        .main a{
            color: #333;
        }
        .main li{
            width: 100%;
            height: 150px;
            padding-left: 40px;
            border-left: 1px solid #dedede;
            list-style: none;
            padding-right: 30px;
            position: relative;
        }
        .direct-list>div{
            width: 750px;
            height: 150px;
            border: 1px solid #dedede;
            border-bottom-color: transparent;
            padding: 19px;
        }
        .direct-list:last-of-type>div{
            border-bottom-color: #ccc;
        }
        .details>div>span{
            border: 1px solid #ccc;
            display: inline-block;
            height: 28px;
            color: #aaa;
            /*width: 60px;*/
            padding: 0 12px;
            text-align: center;
            line-height: 26px;
        }
        .details>div>span i{
            margin:0 5px 0 -5px;
        }
        .details p{
            width: 100%;
            height: 82px;
            padding-top: 10px;
            overflow: hidden;
            margin: 0;
        }
        .main .cont-left{
            width: 600px;
            height: 100%;
            padding: 0;
            position: relative;
            margin: 0;
        }
        .cont-left+.cont-right{
            height: 100%;
            width: 110px;
            float: left;
            border-left: 1px solid #dedede;
            padding: 20px 23px;
        }
        .main .cont-left:before{
            content: '';
            display: table;
            height: 20px;
            border-left: 1px solid #ccc;
            position: absolute;
            top: -40px;
            left: -61px;
        }
        .cont-left>input{
            width: 60px;
            border: 1px solid #ccc;
            height: 28px;
            position: absolute;
            top: 38px;
            left: -91px;
            text-align: center;
            outline: none;
        }
        .cont-details>div:nth-child(1){
            width: 150px;
            height: 100%;
        }
        .cont-details img{
            width: 100%;
        }
        .cont-details .details{
            width: 400px;
            height: 100%;
            padding-left: 10px;
        }
        .cont-right a{
            width: 84px;
            margin-bottom: 10px;
        }
    </style>
    <script>
      $(function() {
        $("#radio").buttonset();
        $("#sortHead").headSort();
        $("#tabs li").each(function(){
          $(this).hover(function(){
            if(!$(this).hasClass("active")) {
              $(this).addClass("hover");
            }
          },function(){
            $(this).removeClass("hover");
          });
        });
        dateTime();
      });
      function dateTime() {

      }
      function confirmDelete() {
        return confirm("<s:message code='confirmDelete'/>");
      }
      function optSingle(opt) {
        if(Cms.checkeds("ids")==0) {
          alert("<s:message code='pleaseSelectRecord'/>");
          return false;
        }
        if(Cms.checkeds("ids")>1) {
          alert("<s:message code='pleaseSelectOne'/>");
          return false;
        }
        var id = $("input[name='ids']:checkbox:checked").val();
        var url = $(opt+id).attr("href");
        if(url) {
          location.href=$(opt+id).attr("href");
        } else {
          alert("<s:message code='noPermission'/>");
        }
      }
      function optMulti(form, action, confirmMsg) {
        if(Cms.checkeds("ids")==0) {
          alert("<s:message code='pleaseSelectRecord'/>");
          return false;
        }
        if(confirmMsg) {
          if($.isFunction(confirmMsg)) {
            if(!confirmMsg()) {
              return false;
            }
          } else {
            if(!confirm(confirmMsg)) {
              return false;
            }
          }
        }
        form.action=action;
        form.submit();
        return true;
      }
      function optDelete(form) {
        optMulti(form,"delete.do",confirmDelete);
      }
      //添加新闻
      function  addInfo() {
        var queryDate=$("#d11").val()+":00";
        queryDate=queryDate.replace('年','-').replace('月','-').replace('日','');
        location.href='/cmscp/core/current_hour/chooseinfolist.do?returnUrl=core/current_hour/currnode_choose_info&targetNodeId=${queryNodeId}&queryDate='+queryDate;
      }
      function changeDate() {
        var queryDate=$("#d11").val()+":00";
        queryDate=queryDate.replace('年','-').replace('月','-').replace('日','');
        location.href='list.do?returnUrl=core/current_hour/currentnews_list&targetNodeId=${queryNodeId}&queryNodeId=${queryNodeId}&queryDate='+queryDate;
      }
      function  clearInfoRef(infoId) {
        var queryDate=$("#d11").val()+":00";
        queryDate=queryDate.replace('年','-').replace('月','-').replace('日','');
        location.href='delCurrentRefInfo.do?returnUrl=core/current_hour/currentnews_list&infoId='+infoId+'&targetNodeId=${queryNodeId}&queryDate='+queryDate;
      }
      //修改发布时间
      function changePublishDate(date,infoId) {
        var queryDate=$("#d11").val()+":00";
        queryDate=queryDate.replace('年','-').replace('月','-').replace('日','');
        var publishDate=$(date).val();
        location.href='changePublishDate.do?returnUrl=core/current_hour/currentnews_list&infoId='+infoId+'&queryNodeId=${queryNodeId}&queryDate='+queryDate+'&publishDate='+publishDate;
      }

      //根据日期生成
      function generationHourAndCurrent() {
        $('#load').showLoading();
        var queryDate=$("#d11").val()+":00";
        queryDate=queryDate.replace('年','-').replace('月','-').replace('日','');
        location.href='generationHourAndCurrent.do?returnUrl=core/current_hour/currentnews_list&queryNodeId=${queryNodeId}&queryDate='+queryDate;
      }

    </script>
</head>
<body class="skin-blue content-body" id="load">
<jsp:include page="/WEB-INF/views/commons/show_message.jsp"/>
<div class="content-header">
    <h1>时讯</h1>
</div>
<div class="content">
    <div class="box box-primary">
        <div class="box-body table-responsive">
            <div class="header">
                <input id="d11" type="text" value="<fmt:formatDate value="${today}" pattern="yyyy年MM月dd日 HH:mm"/>" onClick="WdatePicker({dateFmt:'yyyy年MM月dd日 HH:mm'})"/>
                <a class="btn btn-primary" href="javascript:void(0);" onclick="changeDate()">刷新</a>
                <shiro:hasPermission name="core:current_hour:chooseinfolist">
                <a class="btn btn-default" href="javascript:void(0);" onclick="addInfo()">+添加</a>
                </shiro:hasPermission>

                <shiro:hasPermission name="core:info:generationHourAndCurrent">
                <a class="btn btn-default" href="javascript:void(0);"  onclick="generationHourAndCurrent()" >生成</a>
                </shiro:hasPermission>
            </div>
            <div class="main">
                <ul>
                    <c:forEach var="bean" varStatus="status" items="${infoList}">
                        <li class="direct-list">
                            <div class="clearfix">
                                <div class="cont-left pull-left">
                                    <input type="text" value="<fmt:formatDate value="${bean.publishDate}" pattern="HH:mm"/>" onchange="changePublishDate(this,${bean.id})" onClick="WdatePicker({dateFmt:'HH:mm'})"/>
                                    <div class="cont-details clearfix">
                                        <div class="pull-left"><img src="${bean.detail.smallImage}" alt="图片未加载" onerror="this.src='${ctx}/static/img/no.png'" ></div>
                                        <div class="details pull-left">
                                            <p>${bean.detail.title}</p>
                                            <div>
                                                <c:if test="${bean.newsType eq 2}">
                                                    <span><i class="fa fa-play-circle"></i>音频</span>
                                                    <%--<span>时长：<span>${bean.refInfo.fileLength}</span></span>--%>
                                                </c:if>
                                                <c:if test="${bean.newsType eq 3}">
                                                    <span><i class="fa fa-play-circle"></i>视频</span>
                                                    <span>时长：<span>${bean.videoTime}</span></span>
                                                </c:if>
                                            </div>
                                            <div><span style="color:blue;">真实点击量：${bean.realviews}</span></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="cont-right pull-left">
                                    <a  class="btn btn-default" href="infoedit.do?id=${bean.id}&returnUrl=core/current_hour/currentnews_list&queryDate=<fmt:formatDate value="${today}" pattern="yyyy-MM-dd HH:mm:ss"/>&queryNodeId=${queryNodeId}&queryNodeType=${queryNodeType}&queryInfoPermType=${queryInfoPermType}&queryStatus=${queryStatus}&position=${pagedList.number*pagedList.size+status.index}&${searchstring}">编辑</a>
                                    <a class="btn btn-default" href="javascript:void(0);" onclick="clearInfoRef(${bean.id})">清除</a>
                                </div>
                            </div>
                        </li>
                    </c:forEach>
                </ul>
            </div>
        </div>
    </div>
</div>
</body>
</html>